package package06章_面向对象编程_基础._05oop.exer1_methodMore._03_valueTransfer;

/**
 * @ClassName: e_6_10valueTransferTest
 * @Author 86132
 * @Package package06章_面向对象编程_基础.oop05.exer1_methodMore._03_valueTransfer
 * @Date 2024/2/13 11:34
 * @description:
 */
public class e_6_10valueTransferTest2 {
    public static void main(String[] args) {
        e_6_10valueTransferTest2 test = new e_6_10valueTransferTest2();

        int m = 10;
        int n = 20;

        System.out.println("m = " + m + ", n = " + n);
        //交换两个变量的值
        //操作1：
//        int temp = m;
//        m = n;
//        n = temp;


        //操作2：
        //调用方法
        test.swap(m,n);
        System.out.println("m = " + m + ", n = " + n);
    }
    public void swap(int m ,int n){
        int temp = m;
        m = n;
        n = temp;
    }
}